package com.goodving.guli.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import com.goodving.guli.R;
import com.goodving.guli.bt.C0668a;
import com.goodving.guli.bt.Utils;
import com.soundcloud.android.crop.Crop;

import java.io.File;

/**
 * Created by john on 2015/12/24.
 */
public class CropImageActivity extends SystemBarTintActivity {
    private static final String TAG = "CropImageActivity";

    public void onActivityResult(int i, int i2, Intent intent) {

        String str = Utils.m8079j(getApplicationContext()) + "/bracelet_icon.jpg";
        if ( i == 18 ) {
            if (intent != null) {
                Crop.of(Uri.parse(intent.getDataString()), Uri.fromFile(new File(str))).asSquare().start(this);
            } else {
                finish();
            }
        } else if (i == 6709) {
            Intent mIntent = new Intent();
            mIntent.putExtra("CROPPED_FILE_PATH", str);
            this.setResult(17, mIntent);
            finish();
        } else {
            return;
        }
    }

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView((int) R.layout.crop_image_activity);
        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction("android.intent.action.GET_CONTENT");
        startActivityForResult(intent, 18);

    }

    public void onPause() {
        super.onPause();
        C0668a.m8141b(C0668a.f3570m);
    }

    public void onResume() {
        super.onResume();
        C0668a.m8133a(C0668a.f3570m);
    }
}
